package com.sprucetec.live.mcq;

import com.sprucetec.live.common.dto.business.LiveChatDto;
import com.sprucetec.live.mcq.category.ScheduledProcess;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.xmlbeans.impl.common.ConcurrentReaderHashMap;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledExecutorService;

/**
 * @ClassName McqBusinessMemoryMap
 * @Description:
 * @Author Kenny
 * @Date 2020/5/27
 **/
@Data
@Slf4j
public class McqBusinessMemoryMap {
    // 聊天信息消费端阻塞队列
    public static Map<Long, BlockingQueue<LiveChatDto>> queueHashMap = new ConcurrentHashMap<>();

    // 聊天发送消息到MCQ的 阻塞队列，只有开启才有效
    public static Map<Long, BlockingQueue<LiveChatDto>> addChatQueueHashMap = new ConcurrentHashMap<>();


    // 定时任务批量消费消息方式的定时任务
    public volatile static Map<Long, ScheduledExecutorService> scheduledExecutorServiceMap = new ConcurrentHashMap<>();

    // 定时任务批量消费消息方式的策略, 多房间会创建多个使用spring 多例模式
    public static Map<Long, ScheduledProcess> scheduledProcessHashMap = new ConcurrentHashMap<>();

}
